﻿package toolbar.rudo {
	import flash.display.*;
	import toolbar.icon.UndoIcon;
	import toolbar.NormalButton;
	
	class RedoButton extends NormalButton {
		public function RedoButton(intro:String):void {
			super(intro);
			//使用undo的图标并进行水平翻转
			var icon:UndoIcon = new UndoIcon();
			var newBitmapData:BitmapData  = new BitmapData(icon.width, icon.height, true, 0);
			var oldBitmapData:BitmapData = new BitmapData(icon.width, icon.height, true, 0);
			oldBitmapData.draw(icon);
			for (var y:int = 0; y < oldBitmapData.height; y++) {
				for (var x:int = 0; x < oldBitmapData.width; x++) {
					newBitmapData.setPixel32(oldBitmapData.width - x, y, oldBitmapData.getPixel32(x, y));
				}
			}
			var sprite:Sprite = new Sprite();
			sprite.addChild(new Bitmap(newBitmapData));
			addIcon(sprite);
		}
	}
}